package com.witframework.web.tag.tooltip;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class TextTag extends BodyTagSupport
{
  private String style = null;
  private String className = null;

  public void setStyle(String paramString)
  {
    this.style = paramString;
  }

  public String getStyle()
  {
    return this.style;
  }

  public void setClassName(String paramString)
  {
    this.className = paramString;
  }

  public String getClassName()
  {
    return this.className;
  }

  public int doAfterBody()    throws JspException  {
	String str;
    TooltipTag localTooltipTag = (TooltipTag)findAncestorWithClass(this, TooltipTag.class);
    if (localTooltipTag == null)
      throw new JspException("link: Could not find ancestor tooltip");
    BodyContent localBodyContent = getBodyContent();
    if (localBodyContent == null)
      str = "";
    else
      str = localBodyContent.getString();
    str = str.trim();
    localTooltipTag.setText(str);
    if (this.style != null)
      localTooltipTag.setTextStyle(this.style);
    if (this.className != null)
      localTooltipTag.setTextClassName(this.className);
    if (localBodyContent != null)
      localBodyContent.clearBody();
    return 0;
  }

  public int doEndTag()
    throws JspException
  {
    dropData();
    return 6;
  }

  public void release()
  {
    dropData();
  }

  private void dropData()
  {
    this.style = null;
    this.className = null;
  }
}